package com.hp.windows.listener;

import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.dom.events.DOMEvent;
import com.teamdev.jxbrowser.chromium.dom.events.DOMEventListener;

/**
 * 链接监听
 */
public class MyDOMEventListener implements DOMEventListener {

    private Browser upBrowser;//上部浏览器
    private Browser downBrowser;//下部浏览器
    private String url;//跳转路径

    public MyDOMEventListener(Browser upBrowser, Browser lowerBrowser,String url) {
        this.upBrowser = upBrowser;
        this.downBrowser = lowerBrowser;
        this.url=url;
    }

    /**
     * 事件触发
     * @param domEvent
     */
    public void handleEvent(DOMEvent domEvent) {
        downBrowser.loadURL(url);
    }
}
